﻿@model CustomerDownloadableProductsModel
@using Nop.Web.Models.Customer;
@{
    Layout = "~/Views/Shared/_Root.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.Account").Text);
}
<div class="page account-page downloadable-products-page">
    <div class="page-title">
        <h1>@T("Account.DownloadableProducts")</h1>
    </div>
    <div class="page-body">
        @if (Model.Items.Count > 0)
        {
            <ul data-role="listview" data-inset="true" data-filter="false" data-theme="c">
                @foreach (var item in Model.Items)
                {
                    <li>
                        <div class="item">
                            <div>
                                @T("DownloadableProducts.Fields.Order"): <a href="@Url.RouteUrl("OrderDetails", new { orderId = item.OrderId })">@item.OrderId</a>
                            </div>
                            <div>
                                @T("DownloadableProducts.Fields.Date"): @item.CreatedOn.ToString("d")
                            </div>
                            <div>
                                @T("DownloadableProducts.Fields.Product"): <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })">@item.ProductName</a>
                                @if (!String.IsNullOrEmpty(item.ProductAttributes))
                                {
                                    <div class="attributes">
                                        @Html.Raw(item.ProductAttributes)
                                    </div>
                                }
                            </div>
                            <div>
                                @if (item.DownloadId > 0)
                                {
                                    <div>
                                        <a data-ajax="false" href="@Url.RouteUrl("GetDownload", new { orderItemId = item.OrderItemGuid })">@T("DownloadableProducts.Fields.Download")</a>
                                    </div>
                                }
                                else
                                {
                                    <div>
                                        @T("DownloadableProducts.Fields.Download"): @T("DownloadableProducts.Fields.Download.NA")
                                    </div>
                                }
                                @if (item.LicenseId > 0)
                                {
                                    <div>
                                        <a href="@Url.RouteUrl("GetLicense", new { orderItemId = item.OrderItemGuid })">@T("DownloadableProducts.Fields.DownloadLicense")</a>
                                    </div>
                                }
                            </div>
                        </div>
                    </li>
                }
            </ul>
        }
        else
        {
            <div class="no-data">
                @T("DownloadableProducts.NoItems")
            </div>
        }
    </div>
</div>
